#!/usr/bin/env xonsh

from fire import Fire

@Fire
def main(rgstr):
  rgfile = rgstr.replace("|","_")+'.rg'
  print(rgstr)
  fileli= $(ls *.json.gz).strip("\n").split("\n")
  rm -rf @(rgfile)
  for i in fileli:
    print(i)
    zcat @(i)| rg @(rgstr) >> @(rgfile) &
